
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>用户权限管理系统</title>
		<!-- Tell the browser to be responsive to screen width -->
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<!-- Bootstrap 3.3.7 -->
		<!--bootstrap-validator-->
    <link rel="stylesheet" href="/Public/validators/dist/css/bootstrapValidator.css"/>
     <link rel="stylesheet" href="/Public/bower_components/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css">
  <!-- Bootstrap time Picker -->
  <link rel="stylesheet" href="/Public/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  <link rel="stylesheet" href="/Public/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  <link rel="stylesheet" href="/Public/plugins/timepicker/bootstrap-timepicker.min.css">
  <link rel="stylesheet" href="/Public/bower_components/select2/dist/css/select2.min.css">
		
		<link rel="stylesheet" href="/Public/bower_components/bootstrap/dist/css/bootstrap.min.css">
		<!-- Font Awesome -->
		<link rel="stylesheet" href="/Public/bower_components/font-awesome/css/font-awesome.min.css">
		<!-- Ionicons -->
		<link rel="stylesheet" href="/Public/bower_components/Ionicons/css/ionicons.min.css">
		<!-- DataTables -->
		<link rel="stylesheet" href="/Public/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
		<!-- Theme style -->
		<link rel="stylesheet" href="/Public/dist/css/AdminLTE.min.css">
		<!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
		<link rel="stylesheet" href="/Public/dist/css/skins/_all-skins.min.css">

		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

		<!-- Google Font -->
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
	</head>

	<body class="hold-transition skin-blue sidebar-mini">
		<!-- Site wrapper -->
		<div class="wrapper">

			<header class="main-header">
				<!-- Logo -->
				<a href="../../index2.html" class="logo">
					<!-- mini logo for sidebar mini 50x50 pixels -->
					<span class="logo-mini"><b>R</b>MS</span>
					<!-- logo for regular state and mobile devices -->
					<span class="logo-lg"><b>Role</b>System</span>
				</a>
				<!-- Header Navbar: style can be found in header.less -->
				<nav class="navbar navbar-static-top">
					<!-- Sidebar toggle button-->
					<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
						<span class="sr-only">导航</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</a>

					<div class="navbar-custom-menu">
						<ul class="nav navbar-nav">
							<!-- Messages: style can be found in dropdown.less-->
							<li class="dropdown messages-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-envelope-o"></i>
									<span class="label label-success">4</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 4 messages</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<!-- start message -->
												<a href="#">
													<div class="pull-left">
														<img src="/Public/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
													</div>
													<h4>
                        Support Team
                        <small><i class="fa fa-clock-o"></i> 5 mins</small>
                      </h4>
													<p>Why not buy a new awesome theme?</p>
												</a>
											</li>
											<!-- end message -->
										</ul>
									</li>
									<li class="footer">
										<a href="#">See All Messages</a>
									</li>
								</ul>
							</li>
							<!-- Notifications: style can be found in dropdown.less -->
							<li class="dropdown notifications-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-bell-o"></i>
									<span class="label label-warning">10</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 10 notifications</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<a href="#">
													<i class="fa fa-users text-aqua"></i> 5 new members joined today
												</a>
											</li>
										</ul>
									</li>
									<li class="footer">
										<a href="#">View all</a>
									</li>
								</ul>
							</li>
							<!-- Tasks: style can be found in dropdown.less -->
							<li class="dropdown tasks-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-flag-o"></i>
									<span class="label label-danger">9</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 9 tasks</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<!-- Task item -->
												<a href="#">
													<h3>
                        Design some buttons
                        <small class="pull-right">20%</small>
                      </h3>
													<div class="progress xs">
														<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
															<span class="sr-only">20% Complete</span>
														</div>
													</div>
												</a>
											</li>
											<!-- end task item -->
										</ul>
									</li>
									<li class="footer">
										<a href="#">View all tasks</a>
									</li>
								</ul>
							</li>
							<!-- User Account: style can be found in dropdown.less -->
							<li class="dropdown user user-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<img src="/Public/dist/img/user2-160x160.jpg" class="user-image" alt="">
									<span class="hidden-xs">{$ret.username}</span>
								</a>
								<ul class="dropdown-menu">
									<!-- User image -->
									<li class="user-header">
										<img src="/Public/dist/img/user2-160x160.jpg" class="img-circle" alt="">
         <form  method="post">
       	<input type="hidden" name="user" id="user" value="exit" />
        <input type="submit" id="tuichu" value="退出" />
       </form>
										<p>
											Alexander Pierce - Web Developer
											<small>Member since Nov. 2012</small>
										</p>
									</li>
									<!-- Menu Body -->
									<li class="user-body">
										<div class="row">
											<div class="col-xs-4 text-center">
												<a href="#">Followers</a>
											</div>
											<div class="col-xs-4 text-center">
												<a href="#">Sales</a>
											</div>
											<div class="col-xs-4 text-center">
												<a href="#">Friends</a>
											</div>
										</div>
										<!-- /.row -->
									</li>
									<!-- Menu Footer-->
									<li class="user-footer">
										<div class="pull-left">
											<a href="#" class="btn btn-default btn-flat">Profile</a>
										</div>
										<div class="pull-right">
											<a href="#" class="btn btn-default btn-flat">Sign out</a>
										</div>
									</li>
								</ul>
							</li>
							<!-- Control Sidebar Toggle Button -->
							<li>
								<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
							</li>
						</ul>
					</div>
				</nav>
			</header>
			<!-- =============================================== -->
			<!-- Left side column. contains the sidebar -->
			<aside class="main-sidebar">
				<!-- sidebar: style can be found in sidebar.less -->
				<section class="sidebar">
					<!-- Sidebar user panel -->
					<div class="user-panel">
						<div class="pull-left image">
							<img src="/Public/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
						</div>
						<div class="pull-left info">
							<p>{$ret.username}</p>
							
							<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
						</div>
					</div>
					<!-- search form -->
					<form action="#" method="get" class="sidebar-form">
						<div class="input-group">
							<input type="text" name="q" class="form-control" placeholder="Search...">
							<span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
						</div>
					</form>
					<!-- /.search form -->
					<!-- sidebar menu: : style can be found in sidebar.less -->
					<ul class="sidebar-menu" data-widget="tree">
						<li class="header">主菜单</li>
					</ul>
				</section>
				<!-- /.sidebar -->
			</aside>

			<!-- =============================================== -->

			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>
        用户列表
        
      </h1>
					<ol class="breadcrumb">
						<li>
							<a href="#"><i class="fa fa-dashboard"></i> Home</a>
						</li>
						<li>
							<a href="#">Examples</a>
						</li>
						<li class="active">Blank page</li>
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
				<div class="callout callout-success hide">
                <h4>提示信息</h4>
                <p id="changing0">修改成功！</p>
              </div>	
              <div class="callout callout-warning  hide">
                <h4>提示信息</h4>

                <p id="changing">修改失败！</p>
              </div>	
					<div class="row">
						<div class="col-xs-12">
							<div class="box">
								<div class="box-header">
										<button type="button" class="btn btn-default pull-right" data-toggle="modal" data-target="#modal-add" id="addPeople">新增</button>
								</div>
								<!-- /.box-header -->
								<div class="box-body">
									<table id="example1" class="table table-bordered table-striped">
										<thead>
											<tr>
												<th>编号</th>
												<th>姓名</th>
												<th>昵称</th>
												<th>地址</th>
												<th>手机号</th>
												<th>职业</th>
												<th>身份</th>
												<th>生日</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
										</tbody>
										<tfoot>
											<tr>
												<th>编号</th>
												<th>姓名</th>
												<th>昵称</th>
												<th>职业</th>
												<th>身份</th>
												<th>生日</th>
												<th>操作</th>
											</tr>
										</tfoot>
									</table>
								</div>
								<!-- /.box-body -->
							</div>
							<!-- /.box -->
						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</section>

				<!-- /.content -->
			</div>
			<!-- /.content-wrapper -->

			<footer class="main-footer">
				<div class="pull-right hidden-xs">
					<b>Version</b> 2.4.0
				</div>
				<strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights reserved.
			</footer>

			<!-- Control Sidebar -->
						<!-- /.control-sidebar -->
			<!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
			<div class="control-sidebar-bg"></div>
		</div>
		<!-- ./wrapper -->
<!--add modal start -->
		<div class="modal fade in" id="modal-add" style="display: none; padding-right: 17px;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true"  id="cansel-add">×</span></button>
						<h4 class="modal-title">添加用户</h4>
					</div>
					<div class="modal-body">
						<!-- form start -->	
				<form class="form-horizontal" method="post"  action="tianjia" id="addrole">
                 <input type="hidden" name="group_id" id="uid" value="" />
                 <input type="hidden" name="uid" id="add-uid" value="" />
                 <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">用户名</label>
                    <div class="col-sm-10">
                      <input type="text" class="form-control" name="username"  >
                    </div>
                  </div>
                 <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">昵称</label>
                    <div class="col-sm-10">
                      <input type="text" class="form-control" name="nickname"  >
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">角色</label>
                    <div class="col-sm-10">
                      <select name="role" style="width: 470px;height: 34px; border-color: #d2d6de;" id="roleshow">
                      		<option>无</option>
                      	</select>
                    </div>
                  </div>
                   <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">职业</label>

                    <div class="col-sm-10">
                      <input type="text" class="form-control"  name="work"     >
                    </div>
                  </div>
                   <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">城市</label>
                    <div class="col-sm-10">
                      <!--<input type="text" class="form-control" name="address" >-->
                      	<select name="address" style="width: 470px;height: 34px; border-color: #d2d6de;">
                      		<option>北京</option>
                      		<option>上海</option>
                      		<option>深圳</option>
                      		<option>广州</option>
                      		<option>天津</option>
                      	</select>
                    </div>
                  </div>
                   <div class="form-group">
                <label class="col-sm-2 control-label">生日</label>
               <div class="col-sm-10">
               <div class="input-group date">
                  <input type="text" class="form-control pull-right" id="datepicker"    name="birthday">
                <div class="input-group-addon">
                    <i class="fa fa-calendar"></i>
                  </div>
               </div>
                </div>
                <!-- /.input group -->
              </div>
                 <div class="form-group">
					<label class="col-sm-2 control-label">电话</label>
											<div class="col-sm-10">
												<div class="input-group">
													<input type="text" class="form-control"  name="phone" >
													<div class="input-group-addon">
														<i class="fa fa-phone"></i>
													</div>
												</div>
											</div>
										</div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="checkbox">
                        <label>
                        </label>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button type="submit" class="btn btn-primary">添加</button>
                    </div>
                  </div>
                </form>
						<!-- form end -->
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<!--add model end-->
		<!--edit modal start -->
		<div class="modal fade in" id="modal-update" style="display: none; padding-right: 17px;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true"  id="cansel_edit">×</span></button>
						<h4 class="modal-title">编辑用户</h4>
					</div>
					<div class="modal-body">
						<!-- form start -->	
				<form class="form-horizontal" method="post" action="genxin" id="edit-form">
					<input type="hidden" name="username-edit" id="" value="" />
                   <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">用户名</label>
                    <div class="col-sm-10">
                      <input type="text" class="form-control" name="username"  value="" disabled="disabled">
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">昵称</label>
                    <div class="col-sm-10">
                      <input type="text" class="form-control" name="nickname"  value="{$result.nickname}" >
                    </div>
                  </div>
                   <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">职业</label>

                    <div class="col-sm-10">
                      <input type="text" class="form-control"  name="work"  value="{$result.work}">
                    </div>
                  </div>
                  
                   <div class="form-group">
                    <label for="inputName" class="col-sm-2 control-label">城市</label>
                    <div class="col-sm-10">
                      <input type="text" class="form-control" name="address" value="{$result.address}" >
                    </div>
                  </div>
                   <div class="form-group">
                <label class="col-sm-2 control-label">生日</label>
               <div class="col-sm-10">
               <div class="input-group date">
                  <input type="text" class="form-control pull-right" id="datepicker1"   value=""   name="birthday">
                <div class="input-group-addon">
                    <i class="fa fa-calendar"></i>
                  </div>
               </div>
                </div>
                <!-- /.input group -->
              </div>
                 <div class="form-group">
					<label class="col-sm-2 control-label">电话</label>
											<div class="col-sm-10">
												<div class="input-group">
													<input type="text" class="form-control"  name="phone" value=""    >
													<div class="input-group-addon">
														<i class="fa fa-phone"></i>
													</div>
												</div>
											</div>
										</div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="checkbox">
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button type="submit" class="btn btn-primary">保存</button>
                      <button type="button" class="btn btn-primary">取消</button>
                    </div>
                  </div>
                </form>
						<!-- form end -->
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<!--edit model end-->
		
		<!--del modal start -->
		<form action="delete" method="post" id="del-form">
			<input type="hidden" name="username-del" id="" value="" />
			<div class="modal fade in" id="modal-del" style="display: none; padding-right: 17px;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"><button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
						<h5 id="myModalLabel" class="modal-title">提示</h5></div>
					<div class="modal-body">确定要删除吗？</div>
					<div class="modal-footer">
                      <button type="submit" class="btn btn-primary">是</button>
						<button class="btn btn-default btn-sm" type="button" data-dismiss="modal" id="cansel_del">否</button>
					</div>
				</div>
			</div>
			<!-- /.modal-dialog -->
		</div>
		</form>
		<!--del model end-->
		<!-- InputMask -->
		<script src="/Public/bower_components/jquery/dist/jquery.min.js"></script>
		<!-- Bootstrap 3.3.7 -->
		<script src="/Public/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		
		<script src="/Public/js/MEAU.js" ></script>
			
		<!-- bootstrap datepicker -->
<!-- date-range-picker -->
<script src="/Public/bower_components/moment/min/moment.min.js"></script>
<script src="/Public/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- bootstrap datepicker -->
<script src="/Public/bower_components/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<script src="/Public/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
<script src="/Public/bower_components/bootstrap-datepicker/dist/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<!-- bootstrap color picker -->
<script src="/Public/bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
<!-- bootstrap time picker -->
<script src="/Public/plugins/timepicker/bootstrap-timepicker.min.js"></script>
  <link rel="stylesheet" href="/Public/bower_components/select2/dist/css/select2.min.css">
	<link rel="stylesheet" href="/Public/plugins/iCheck/all.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="/Public/bower_components/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css">
	<!--bootstrap-validator-->
    <script  src="/Public/validators/dist/js/bootstrapValidator.js"></script>
		<!-- jQuery 3 -->
		
		<!-- DataTables -->
		<script src="/Public/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
		<script src="/Public/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
		<!-- SlimScroll -->
		<script src="/Public/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
		<!-- FastClick -->
		<script src="/Public/bower_components/fastclick/lib/fastclick.js"></script>
		<!-- AdminLTE App -->
		<script src="/Public/dist/js/adminlte.min.js"></script>
		<!-- AdminLTE for demo purposes -->
		<script src="/Public/dist/js/demo.js"></script>
		<script type="text/javascript">
			$("#example1").on("click","[name='edit1']",function(){
				var tr=$(this).parent().parent();
				  var username=tr.children().eq(1).html();
				  var nickname=tr.children().eq(2).html();
				  var address=tr.children().eq(3).html();
				  var phone=tr.children().eq(4).html();
				  var work=tr.children().eq(5).html();
				  var role=tr.children().eq(6).html();
				  var birthday=tr.children().eq(7).html();
				$("#edit-form input[name='username']").val(username);
				$("#edit-form input[name='nickname']").val(nickname);
				$("#edit-form input[name='address']").val(address);
				$("#edit-form input[name='phone']").val(phone);
				$("#edit-form input[name='work']").val(work);
				$("#edit-form input[name='role']").val(role);
				$("#edit-form input[name='birthday']").val(birthday);
				$("#edit-form input[name='username-edit']").val(username);
			});
			$("#example1").on("click","[name='del1']",function(){
				var tr=$(this).parent().parent();
				  var username=tr.children().eq(1).html();
				 $("#del-form input[name='username-del']").val(username);
			})
		</script>
		<script>
			$(document).ready(function() {
				$('.treeview:nth-child(3)').addClass('active');
				$('.treeview:nth-child(3)').addClass('menu-open');
				$('.treeview:nth-child(3) .treeview-menu').css('display', 'block');
				$('.treeview:nth-child(3) .treeview-menu li:nth-child(3)').addClass('active');
//				var dataSet=[];
//				for (var i = 0; i < 20; i++) {
//				dataSet.push([i,Math.random(),"测试","数据",'<div class="btn-group"><button type="button" class="btn btn-default">Left</button><button type="button" class="btn btn-default">Middle</button><button type="button" class="btn btn-default">Right</button></div>']);
//			}	
         (function(){
         	$.ajax({
					type:"post",
					url:"/home/user/bigger",
					success:function(data){
						 var big=parseInt(data.id)+1;
						$("#add-uid").val(big)
						console.log($("#add-uid").val());
					}
				});
         })();
         
        
         
				  $('#example1').dataTable( {
//				  	  "data": dataSet,
//'columnDefs':[{
//					"orderable":false,
//					"targets":[0,5]
//				}],
                "processing":true,
                 "serverSide":true,
//             "ajax":"/home/user/itemlist",
//             "ajax":"/home/user/serverlist",
               "ajax":"/home/user/serverdblist",
                    "language": {
        "sProcessing": "处理中...",
        "sLengthMenu": "显示 _MENU_ 项结果",
        "sZeroRecords": "没有匹配结果",
        "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
        "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
        "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
        "sInfoPostFix": "",
        "sSearch": "搜索:",
        "sUrl": "",
        "sEmptyTable": "表中数据为空",
        "sLoadingRecords": "载入中...",
        "sInfoThousands": ",",
        "oPaginate": {
            "sFirst": "首页",
            "sPrevious": "上页",
            "sNext": "下页",
            "sLast": "末页"
        }
        }
                } );
				$('.sidebar-menu').tree();
				 $('#datepicker').datepicker({
      autoclose: true,
      language:"zh-CN",
     todayHighlight: true,
     format:"yyyy-mm-dd"
    });
    $('#datepicker1').datepicker({
      autoclose: true,
      language:"zh-CN",
     todayHighlight: true,
     format:"yyyy-mm-dd"
    });
    //添加用户
          $('#addrole').bootstrapValidator({
          	message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
        	username: {
                    validators: {
                        notEmpty: {
                            message: '用户名不能为空'
                        }
                    }
               },
        	nickname: {
                    validators: {
                        notEmpty: {
                            message: '昵称不能为空'
                        }
                    }
               },
               work: {
                    validators: {
                        notEmpty: {
                            message: '职业不能为空'
                        }
                    }
               },
               
               birthday: {
                    validators: {
                        notEmpty: {
                            message: '生日不能为空'
                        }
                    }
               },
        	 phone: {
                    validators: {
                        notEmpty: {
                            message: '手机号码不能为空'
                        },
                         regexp: {
                            regexp: /^1[35678]\d{9}$/,
                            message: '手机格式不正确'
                        }
                    }
              },
              
        }
			}).on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();
            // Get the form instance
            var $form = $(e.target);
            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');
            // Use Ajax to submit form data
            $.post($form.attr('action'), $form.serialize(), function(result) {
               if (result.code==10) {
               	$("#cansel-add").trigger("click");
               	$("#changing").html(result.msg);
               	$(".callout-warning").removeClass("hide");
               	 setTimeout(function(){
               	  		$(".callout-warning").hide(1000);
               	  },1000)
               }else if(result.code==0){
               	$("#cansel-add").trigger("click");
               		$("#changing0").html(result.msg);
               	$(".callout-success").removeClass("hide");
               	  setTimeout(function(){
               	  		$(".callout-success").hide(1000);
               	  },1000)
               }else{
               	$(".callout-warning").removeClass("hide");
               	  $("#bt").removeAttr("disabled");
               }
            }, 'json');
        });
//			编辑信息
			$("#edit-form").bootstrapValidator({
          	message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
        	phone: {
                    validators: {
                        notEmpty: {
                            message: '手机号码不能为空'
                        },
                         regexp: {
                            regexp: /^1[35678]\d{9}$/,
                            message: '手机格式不正确'
                        }
                    }
                    }
        }
			}).on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();
            // Get the form instance
            var $form = $(e.target);
            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');
            // Use Ajax to submit form data
            $.post($form.attr('action'), $form.serialize(), function(result) {
               if(result.code==0){
               $("#cansel_edit").trigger("click");
               $("#changing0").html(result.msg);
               	$(".callout-success").removeClass("hide");
               	  setTimeout(function(){
               	  		$(".callout-success").hide(1000);
               	  },1000)
               }else{
               	$(".callout-warning").removeClass("hide");
               	  $("#bt").removeAttr("disabled");
               }
            }, 'json');
        });
//		start	删除用户
    $("#del-form").bootstrapValidator({
    }).on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();
            // Get the form instance
            var $form = $(e.target);
            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');
            // Use Ajax to submit form data
            $.post($form.attr('action'), $form.serialize(), function(result) {
               if(result.code==0){
               	$("#cansel_del").trigger("click");
               	$(".callout-success").removeClass("hide");
               	  setTimeout(function(){
               	  		$(".callout-success").hide(1000);
               	  },1000)
               }else{
               	$(".callout-warning").removeClass("hide");
               	  $("#bt").removeAttr("disabled");
               }
            }, 'json');
        });
        
			$("#addPeople").on("click",function(){
				$.ajax({
					type:"post",
					url:"/home/user/loadrole",
					success:function(data){
						var opt=[];
						for (var i = 0; i < data.length; i++) {
						opt.push("<option>" +data[i].title + "</option>")
						}
							$("#roleshow").append(opt.join());
						
					}
				});
				
			})
			//end 删除用户
			$("#roleshow").on("click",function(){
				  var role=$(this).val();
				if(role=="超级管理员"){
					var num=1;
					$("#uid").val(num);
				}else if(role=="管理员"){
					var num=2;
					$("#uid").val(num);
				}else if(role=="普通用户"){
					var num=3;
					$("#uid").val(num);
				}
			})
			$("#tuichu").on("click",function(){
					sessionStorage["rules"]="";
				})
			})
		</script>
		
	</body>

</html>